﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_WA_GetDutyDay]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_WA_GetDutyDay];
GO
CREATE PROCEDURE [dbo].[sproc_WA_GetDutyDay] --得到要上班的日期
    @begintime datetime,
    @endtime datetime
AS
BEGIN
SET NOCOUNT ON

declare @beginDayValue int;
declare @endDayValue int;

set @beginDayValue = dbo.fn_GetDayValue ( @begintime );
set @endDayValue = dbo.fn_GetDayValue ( @endtime );

select *
from dbo.UDS_WorkAttendence_DaySetting
where
    (DayValue between @beginDayValue and @endDayValue)
    and NeedDuty = 1
order by
	DayValue asc;

END
GO